package com.site.model.dining;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 餐厅分类属性
 * @author jack
 */
@Entity
@Table(name = "t_restaurant_pro_value")
public class RestaurantProValueInfo implements Serializable {

	private static final long serialVersionUID = -3389529144795998512L;
	
	private Long id;
	/*
	 * 名称
	 */
	private String name;
	/*
	 * 父
	 */
	private RestaurantProValueInfo parentInfo;
	/*
	 * 子
	 */
	private List<RestaurantProValueInfo> childrenList;  

	@Id
	@GeneratedValue
	@Column(name = "ID")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	@Column(name = "NAME")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@ManyToOne
	@JoinColumn(name="PARENT_ID", referencedColumnName = "ID")
	public RestaurantProValueInfo getParentInfo() {
		return parentInfo;
	}
	public void setParentInfo(RestaurantProValueInfo parentInfo) {
		this.parentInfo = parentInfo;
	}
	@OneToMany(mappedBy = "parentInfo", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public List<RestaurantProValueInfo> getChildrenList() {
		return childrenList;
	}
	public void setChildrenList(List<RestaurantProValueInfo> childrenList) {
		this.childrenList = childrenList;
	}
}
